import Base from '../../base'
import view from '../../views/selectRole/roleAnimation.json'

export default class RoleAnimation extends Base {

	constructor(scene) {
		super(scene, view)
	}

	create() {
		let roleData = this.scene.selectRoleModule.roleData
		if(roleData.left){
			if(roleData.left.checked){
				this.scene.roleAnimationModule.showAnimation(roleData.left.job, roleData.left.sex, 'left')
			}
		}
	}

	showAnimation(job, sex, wz='left'){
		let name = job + sex.replace(sex[0], sex[0].toUpperCase())
		this.view[name].setVisible(true)
		this.view[name].anims.play(this.view[name].conf.url)
	}
}